//获取cookie
function getCookie(key){
    let strCookie=document.cookie;
    let arrCookie=strCookie.split(", ");
    for (let i = 0; i < arrCookie.length; i++) {
       let tiem=arrCookie[i].split("=");
       if(tiem[0]==key){
           return tiem[1];
       }
    return "";
    }
}
//设置cookie
function setCookie(key,value,day){
    if(day==undefined){
        document.cookie=`${key}=${value}`;

    }else{
        let n=new Date();
        n.setDate(n.getDate()+day);
        document.cookie=`${key}=${value};expires=`+n;

    }
}
//删除connkie
function delCookie(key){
    setCookie(key,"",-1)
}